﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Data.OracleClient;
using System.Data.OleDb;
using System.Text;

namespace Kenly.DBFramework.Gateway
{
    /// <summary>
    /// Represents a attribute that contains metadata of a Parameter,it can be used to marke a property only.
    /// </summary>
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    public sealed class ParameterAttribute : Attribute
    {
        private string _name = "";
        private int _size;
        private SqlDbType _sqlDbType = SqlDbType.NVarChar;
        private OracleType _oracleType = OracleType.NVarChar;
        private OleDbType _oleDbType = OleDbType.VarWChar;
        private ParameterDirection _direction = ParameterDirection.InputOutput;

        /// <summary>
        /// 
        /// </summary>
        public ParameterAttribute()
        {
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        public ParameterAttribute(string name)
        {
            _name = name;
        }

        /// <summary>
        /// 
        /// </summary>
        public string Name
        {
            get
            {
                return _name;
            }
            set
            {
                _name = value;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        public int Size
        {
            get
            {
                return _size;
            }
            set
            {
                _size = value;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        public SqlDbType SqlDbType
        {
            get
            {
                return _sqlDbType;
            }
            set
            {
                _sqlDbType = value;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        public OracleType OracleType
        {
            get
            {
                return _oracleType;
            }
            set
            {
                _oracleType = value;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        public OleDbType OleDbType
        {
            get
            {
                return this._oleDbType;
            }
            set
            {
                this._oleDbType = value;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        public ParameterDirection Direction
        {
            get
            {
                return _direction;
            }
            set
            {
                _direction = value;
            }
        }

    }
}
